// 21 种 buff 和 24 种 debuff
// 战斗回合中，因为buff失去的属性不会在buff消失时恢复
// 战斗结束后只可能损失hp mp，其他属性值会变回战前属性值。
const buffNames = `armor-punch.png, arrow-cluster.png, boomerang-cross.png, deadly-strike.png, dripping-blade.png, dripping-knife.png, embrassed-energy.png, fire-dash.png, heartburn.png, kitchen-knives.png, machete.png, mighty-force.png, rune-sword.png, shining-heart.png, spiral-arrow.png, supersonic-bullet.png, swords-power.png, templar-heart.png, winged-sword.png, zeus-sword.png, heart-plus`;
const debuffNames = `achilles-heel.png, bleeding-eye.png, broken-bone.png, cupidon-arrow.png, daemon-pull.png, despair.png, enrage.png, floating-tentacles.png, fluffy-trefoil.png, gooey-impact.png, knockout.png, mouth-watering.png, pierced-heart.png, screaming.png, shattered-sword.png, sight-disabled.png, skeleton-inside.png, slashed-shield.png, spider-web.png, surprised-skull.png, sword-break.png, thrown-charcoal.png, william-tell-skull.png, heart-minus`;
// 归0 反伤 全属性减少的才有概率触发一说
const buffTips = [
    ["正义铁拳", "概率眩晕"],
    ["多重箭矢", "必定碎裂"],
    ["回旋", "必定缠绕"],
    ["临终一击", "濒死(生命<10%)时攻击翻倍"],
    ["七伤剑", "必定脆骨"],
    ["剃刀", "必定受伤"],
    ["全身抵抗", "加防御"],
    ["速度暴涨", "加速度"],
    ["燃烧生命", "掉血加攻击"],
    ["飞刀", "加攻加速"],
    ["毒刃", "必定腐蚀"],
    ["力量爆发", "全属性临时上涨"],
    ["咒术之剑", "概率惊爆"],
    ["闪亮之星", "立即恢复生命"],
    ["虚弱之剪", "必定致残"],
    ["超级狙击", "加暴击"],
    ["双刃", "概率双倍伤害"],
    ["生命祝福", "概率血翻倍"],
    ["天使之剑", "加攻击(依照血和防)"],
    ["宙斯之剑", "概率附加麻痹"],
    ["强心", "加生命加智慧"],
]
const debuffTips = [
    ["致残", "减速度"],
    ["致盲", "减命中"],
    ["脆骨", "减防御"],
    ["受伤", "掉血"],
    ["缠绕", "减幸运"],
    ["低落", "减攻击"],
    ["愤怒", "加攻击减命中"],
    ["失智", "减蓝"],
    ["混乱", "概率攻击自己，攻击归0"],
    ["爆炸", "概率暴击伤自己"],
    ["晕眩", "攻击归0，减防御"],
    ["饥渴", "减攻加速"],
    ["腐蚀", "掉血，减防"],
    ["惊惧", "攻击归0，加速"],
    ["易损", "减攻击"],
    ["致盲", "减命中"],
    ["麻痹", "攻击归0，减幸运"],
    ["碎裂", "减防御"],
    ["蛛网", "减速度"],
    ["惊爆", "概率减全属性(智慧减免其效果)"],
    ["破碎武器", "减攻击"],
    ["碎片飞溅", "攻击反伤"],
    ["致命", "概率一击猝死"],
    ["失血", "减生命，减智慧"],
]
// 附加buff buff
// 加入战斗队列 battleQueue
const buffData = [
    {
        func: function (stat, tag, target) {
            if (getRandomRange(1, 10) < 4) {
                battleQueue.push({ tag, target, id: 10, type: 1, turn: 1 });
            }
        }
    },
    {
        func: function (stat, tag, target) {
            battleQueue.push({ tag, target, id: 17, type: 1, turn: 3 });
        }
    },
    {
        func: function (stat, tag, target) {
            battleQueue.push({ tag, target, id: 4, type: 1, turn: 3 });
        }
    },
    {
        func: function (stat) {
            stat[2] *= 2;
        }
    },
    {
        func: function (stat, tag, target) {
            battleQueue.push({ tag, target, id: 2, type: 1, turn: 3 });
        }
    },
    {
        func: function (stat, tag, target) {
            battleQueue.push({ tag, target, id: 3, type: 1, turn: 3 });
        }
    },
    {
        func: function (stat) {
            stat[3] += 10;
        }
    },
    {
        func: function (stat) {
            stat[6] += 10;
        }
    },
    {
        func: function (stat) {
            stat[0] -= 5;
            stat[2] += 20;
        }
    },
    {
        func: function (stat) {
            stat[2] += 5;
            stat[6] += 10;
        }
    },
    {
        func: function (stat, tag, target) {
            battleQueue.push({ tag, target, id: 12, type: 1, turn: 3 });
        }
    },
    {
        func: function (stat) {
            for (let i = 2; i < stat.length; i++) {
                stat[i] += 5;
            }
        }
    },
    {
        func: function (stat, tag, target) {
            battleQueue.push({ tag, target, id: 19, type: 1, turn: 1 });
        }
    },
    {
        func: function (stat) {
            stat[0] += 40;
        }
    },
    {
        func: function (stat, tag, target) {
            battleQueue.push({ tag, target, id: 0, type: 1, turn: 3 });
        }
    },
    {
        func: function (stat) {
            stat[7] += 20;
        }
    },
    {
        func: function (stat) {
            if (getRandomRange(1, 10) < 4) {
                stat[2] *= 2;
            }
        }
    },
    {
        func: function (stat) {
            stat[0] *= 2;
        }
    },
    {
        func: function (stat) {
            stat[2] += Math.round(stat[0] / 5 + stat[3] / 4)
        }
    },
    {
        func: function (stat, tag, target) {
            if (getRandomRange(1, 10) < 4) {
                battleQueue.push({ tag, target, id: 16, type: 1, turn: 1 });
            }
        }
    },
    {
        func: function (stat) {
            stat[0] += 20;
            stat[1] += 10;
        }
    },
];
// 特殊效果 一击猝死 func
// 加入战斗队列 battleQueue
const debuffData = [
    {
        func: function (stat) {
            stat[6] -= 2;
        }
    },
    {
        func: function (stat) {
            stat[4] -= 2;
        }
    },
    {
        func: function (stat) {
            stat[3] -= 2;
        }
    },
    {
        func: function (stat) {
            stat[0] -= 2;
        }
    },
    {
        func: function (stat) {
            stat[5] -= 2;
        }
    },
    {
        func: function (stat) {
            stat[2] -= 2;
        }
    },
    {
        func: function (stat) {
            stat[2] += 4;
            stat[4] -= 2;
        }
    },
    {
        func: function (stat) {
            stat[1] -= 2;
        }
    },
    {
        func: function (stat) {
            if (getRandomRange(1, 10) < 6) {
                stat[0] -= Math.round(stat[2] / 2)
                stat[2] = 0
            }
        }
    },
    {
        func: function (stat) {
            if (getRandomRange(1, 10) < 6) {
                stat[0] -= Math.round(stat[6] / 3)
            }
        }
    },
    {
        func: function (stat) {
            if (getRandomRange(1, 10) < 8) {
                stat[3] -= 4
                stat[2] = 0
            }
        }
    },
    {
        func: function (stat) {
            stat[6] += 4;
            stat[2] -= 2;
        }
    },
    {
        func: function (stat) {
            stat[0] -= 2;
            stat[3] -= 2;
        }
    },
    {
        func: function (stat) {
            if (getRandomRange(1, 10) < 8) {
                stat[6] += 4
                stat[2] = 0
            }
        }
    },
    {
        func: function (stat) {
            stat[3] -= 4;
        }
    },
    {
        func: function (stat) {
            stat[4] -= 4;
        }
    },
    {
        func: function (stat) {
            if (getRandomRange(1, 10) < 8) {
                stat[5] -= 4
                stat[2] = 0
            }
        }
    },
    {
        func: function (stat) {
            stat[3] -= 5;
        }
    },
    {
        func: function (stat) {
            stat[6] -= 5;
        }
    },
    {
        func: function (stat) {
            if (getRandomRange(1, 10) < 4) {
                for (let i = 2; i < stat.length; i++) {
                    stat[i] -= Math.round(40 / stat[1])
                }
            }
        }
    },
    {
        func: function (stat) {
            stat[2] = Math.round(stat[2] / 3);
        }
    },
    {
        func: function (stat) {
            if (getRandomRange(1, 10) < 6) {
                stat[0] -= Math.round(stat[2] / 3);
            }
        }
    },
    {
        func: function (stat) {
            if (getRandomRange(1, 10) < 2) {
                stat[0] = 0;
            }
        }
    },
    {
        func: function (stat) {
            stat[0] -= 2;
            stat[1] -= 2;
        }
    },
];